A Scatter chart using the Google Sheets connector
This goes in the documents header:
<script src="../libraries/RGraph.common.core.js" ></script>
<script src="../libraries/RGraph.common.sheets.js" ></script>
<script src="../libraries/RGraph.scatter.js" ></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="700" height="250">
[No canvas support]
</canvas>
This is the code that generates the chart:
<script>
new RGraph.Sheets('1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E', 3, function (sheet)
{
var x = sheet.get('A2:A11'),
y = sheet.get('B2:B11'),
p = [];
for (var i=0; i<x.length; i++) {
p.push([x[i], y[i]]);
}
var line = new RGraph.Scatter({
id: 'cvs',
data: p,
options: {
xmax: 100,
labels: ['Q1','Q2','Q3','Q4'],
noxaxis:true,
textAccessible: true
}
}).draw();
});
</script>